<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function myFoo(){

        var i = 0;
        function foo(){

            i = i + 1;
            console.log(i);
            function foo1(){
                console.log('foo1:'+i);
            }

//            doo();

        }

        function doo(){
            console.log('I am in doo');
            foo();
        }
        foo();

    }

    myFoo();

</script>
</body>
</html>